home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / MACRO.C < prev    next >
Text File  |  1989-12-30  |  512b  |  18 lines

  1. #define WRONG(A) A*A*A      /* Wrong macro for cube */
  2. #define CUBE(A) (A)*(A)*(A) /* Right macro for cube */
  3. #define SQUR(A) (A)*(A)     /* Right macro for square */
  4. #define START 1
  5. #define STOP  9
  6.  
  7. main()
  8. {
  9. int i,offset;
  10.  
  11.    offset = 5;
  12.    for (i = START;i <= STOP;i++) {
  13.       printf("The square of %3d is %4d, and its cube is %6d\n",
  14.               i+offset,SQUR(i+offset),CUBE(i+offset));
  15.       printf("The wrong of  %3d is %6d\n",i+offset,WRONG(i+offset));
  16.    }
  17. }
  18.